package nc.pub.util;

import java.io.File;
import java.io.FileInputStream;
import java.util.Properties;

import nc.bs.framework.common.InvocationInfoProxy;
import nc.bs.framework.common.RuntimeEnv;

public class CMPPubCommon {

	public static final String filePath = RuntimeEnv.getInstance().getNCHome() + File.separator + "modules"
			+ File.separator + "baseapp" + File.separator + "classes" + File.separator + "nc" + File.separator + "pub"
			+ File.separator + "util" + File.separator + "cmppubcommon.properties";

	public static void initDesign() {

		String NCCDsName = "design";

		try {
			FileInputStream fileis = new FileInputStream(filePath);

			Properties properties = new Properties();

			properties.load(fileis);

			NCCDsName = properties.getProperty("NCCDsName");

		} catch (Exception e) {
		}
		InvocationInfoProxy.getInstance().setUserDataSource(NCCDsName);
	}

	public static String getProperties(String key) {
		String value = "";
		try {
			FileInputStream fileis = new FileInputStream(filePath);

			Properties properties = new Properties();

			properties.load(fileis);

			value = properties.getProperty(key);

		} catch (Exception e) {
		}
		return value;
	}
}
